import Vue from "vue";
import VueRouter from "vue-router";
import HomeView from "../views/HomeView.vue";

Vue.use(VueRouter);
const routes = [
  {
    path: "/pay",
    name: "付款页",
    component: () => import("../views/Aaa.vue"),
    meta: {
      hide: true,
    },
  },
  {
    path: "/root",
    name: "后台首页",
    redirect: "/root/home",
    component: () => import("../views/Root.vue"),
    meta: {
      hide: true, //是否需要隐藏头尾
      rootlogin: true, //需要加校验判断的路由
    },
    children: [
      {
        path: "home",
        name: "首页",

        component: () => import("../views/RootHome.vue"),
        meta: {
          hide: true,
          rootlogin: true, //需要加校验判断的路由
        },
      },
      {
        path: "rootuser",
        name: "用户管理",

        component: () => import("../views/Rootuser.vue"),
        meta: {
          hide: true,
          rootlogin: true, //需要加校验判断的路由
        },
      },
      {
        path: "rootstyle",
        name: "菜品管理",
        component: () => import("../views/Rootstyle.vue"),
        meta: {
          hide: true,
          rootlogin: true, //需要加校验判断的路由
        },
      },
    ],
  },
  {
    path: "/rootlogin",
    name: "后台登录",
    component: () => import("../views/Rootlogin.vue"),
  },
  {
    path: "*",
    name: "404",
    component: () => import("../views/404.vue"),
  },
  {
    path: "/meaning",
    name: "用户中心",
    redirect: "/meaning/home",
    component: () => import("../views/Meaning.vue"),
    children: [
      {
        path: "home",
        component: () => import("../views/M_Home.vue"),
        meta: {
          keepAlive: true, //指明当前组件需要保活
        },
      },
      {
        path: "notice",
        component: () => import("../views/Notice.vue"),
      },
    ],
  },
  {
    path: "/login",
    name: "Login",
    component: () => import("../views/Login.vue"),
  },
  {
    path: "/area",
    name: "area",
    component: () => import("../views/Area"),
  },
  {
    path: "/subject",
    name: "专题",
    component: () => import("../views/Subject"),
  },
  {
    path: "/",
    name: "home",
    component: HomeView,
  },
  {
    path: "/nav",
    name: "nav",
    component: () => import("../views/Nav.vue"),
  },
  {
    path: "/xch",
    name: "xch",
    redirect: "Xch/home",
    component: () => import("../views/Xch.vue"),
    meta: {
      hide: true, //是否需要隐藏头尾
    },
    children: [
      {
        path: "home",
        name: "xch",
        component: () => import("../views/Xchhome.vue"),
        meta: {
          hide: true,
        },
      },
      {
        path: "cxcy",
        name: "cxcy",
        component: () => import("../views/Cxcy.vue"),
        meta: {
          hide: true,
        },
      },
      {
        path: "super",
        name: "super",
        component: () => import("../views/Super.vue"),
        meta: {
          hide: true,
        },
      },
      {
        path: "type",
        name: "type",
        component: () => import("../views/Type.vue"),
        meta: {
          hide: true,
        },
      },
      {
        path: "list",
        name: "list",
        component: () => import("../views/List.vue"),
        meta: {
          hide: true,
        },
      },
      {
        path: "detail",
        name: "Ceshi",
        component: () => import("../views/Ceshi.vue"),
        meta: {
          hide: true,
        },
      },
    ],
  },
];

const router = new VueRouter({
  base: "/dist",
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
